﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;


namespace IDE_week2_Forms_project
{
    public partial class Form1 : Form
    {
        System.Drawing.Icon icon2 = Properties.Resources.Icon2;
        System.Drawing.Icon icon1 = Properties.Resources.Icon1;
        
        public Form1()
        {
            InitializeComponent();

        }
       
       Form f2 = new Form2();
        private void btnOpenNewForm_Click(object sender, EventArgs e)
        {
            f2.Show();
            f2.Icon = icon2;
        }

        private void btnChangeIcon_Click(object sender, EventArgs e)
        {

            this.Icon = icon1;
            f2.Icon = icon2;
            
        }

        private void btnResetIcon_Click(object sender, EventArgs e)
        {
            f2.Icon = icon2;
            this.Icon = icon2;
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            this.Icon = icon2;
        }
        string language;
        private void ChangeLanguage(string lang)
        {
            this.language = lang;
            foreach (Control c in this.Controls)
            {
                ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));
                resources.ApplyResources(c, c.Name, new CultureInfo(lang));
            }
        }

        private void btnChangeLanguage_Click(object sender, EventArgs e)
        {
            if (language == ("en"))
            {
                ChangeLanguage("et-EE");
            }
            else
            {
                ChangeLanguage("en");
            }


        }

        private void btnCallClass1_Click(object sender, EventArgs e)
        {
            int[] numbers = new int[10];
            Class1.MakeRandomNumber(numbers);
            label1.Text = numbers[0] + ", " + numbers[1] + ", " + numbers[2];
        }
    }
}
